package com.zhentao.day04.am.exp2;

import org.testng.annotations.Test;

/**
 * 保险公司类
 */
public class Insurer {
  // 公司名称 投保人姓名, 投保人性别,投保人手机号,投保人身份证号
  private String name ;
  private String userName ;
  private String sex ;
  private String phone ;
  private String cardId ;
  // 生成有参,无参方法,生成get,set方法

  /**
   * 定义show方法 ,用来展示客户信息,
   * 其中身份证号只显示后4位其余均为*号,
   * 手机号只显示前三位和后4位,其他也是*代替(1分)
   */
  @Test
  public void show(){
    // 实现手机号与身份证的值的变换
    // 分析 手机号 11位 需要改变4位
    // String phone = this.phone;
    String phone = "13013142031";
    String shou = phone.substring(0,3);
    String wei = phone.substring(7,11);
    this.phone = shou + "****"+wei ;

    // String cardId = this.cardId;
    String cardId = "130123100020300010";
    String wei2 = cardId.substring(14,18);
    String tou = "";
    for (int i = 0; i < this.cardId.length(); i++) {
      tou+="*";
    }
    this.cardId = tou + wei2;



    System.out.println(this.name + " "
        + this.userName + " "
        + this.sex + " "
        + this.phone + " "
        + this.cardId
    );
  }

  public Insurer() {
  }

  public Insurer(String name, String userName, String sex, String phone, String cardId) {
    this.name = name;
    this.userName = userName;
    this.sex = sex;
    this.phone = phone;
    this.cardId = cardId;
  }


  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getUserName() {
    return userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

  public String getSex() {
    return sex;
  }

  public void setSex(String sex) {
    this.sex = sex;
  }

  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }

  public String getCardId() {
    return cardId;
  }

  public void setCardId(String cardId) {
    this.cardId = cardId;
  }
}
